function [ D ] = createDomain( vert, edge, param )
%CREATEDOMAIN Summary of this function goes here
%   Detailed explanation goes here

% n = max(size(ix, 1), size(ix, 2));

% ex = [(x(1:n-1) + x(2:n)) / 2, (x(n) + x(1)) / 2];
% ey = [(y(1:n-1) + y(2:n)) / 2, (y(n) + y(1)) / 2];

% compute normal

% v1 = [x(1) - x(2), y(1) - y(2), 0];
% v2 = [x(3) - x(2), y(3) - y(2), 0];

% up = [0, 0, 1];
% 
% nx = zeros(n, 1);
% ny = zeros(n, 1);
% l = zeros(n, 1);

% for i = 1 : n
%    i0 =  i;
%    i1 = mod(i, n) + 1;
%    v = [x(i1) - x(i0), y(i1) - y(i0), 0];
%    
%    nv = cross(up, v);
%    nv = normalize(nv);
%    
%    nx(i) = nv(1);
%    ny(i) = nv(2);
%    l(i) = sqrt(v(1)^2 + v(2)^2);
% end

global magicE poissonRatio shearModulus;

magicE = 0;
poissonRatio = 0.45 / (1 + 0.45);
shearModulus = 20 / (2 + 2 * poissonRatio);

input_vn = size(vert, 1);
input_en = size(edge, 1);

input_conf = [1; param.min_edge_length; param.max_edge_length; param.merge_epsilon; param.max_area_change; input_vn ; input_en];
input_vert = reshape(vert', 2 * input_vn, 1);
input_edge = reshape(edge', 2 * input_en, 1);

% D = struct('x', x, 'y', y, 'ex', ex, 'ey', ey, 'nx', nx, 'ny', ny, 'l', l);

D = updateFromElTopo(input_conf, input_vert, input_edge);

end

